package com.sworm.batch.service.impl;

import com.sworm.batch.model.LoveBean;
import com.sworm.batch.model.PersonBean;
import com.sworm.batch.repository.LoveRepository;
import com.sworm.batch.repository.PersonRepository;
import com.sworm.batch.service.IPersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class PersonServiceImpl implements IPersonService {

    @Autowired
    private PersonRepository personRepository;

    @Autowired
    private LoveRepository loveRepository;

    @Override
    public PersonBean addPerson(PersonBean person){
        return personRepository.save(person);
    }

    @Override
    public PersonBean findOnePerson(long id) {
        return personRepository.findById(id).get();
    }

    @Override
    public LoveBean loves(LoveBean love) {
        return loveRepository.save(love);
    }
}
